<template>
    <div>
        <Title :title="title"></Title>
        <div ref="bottom3" style="height: 120px;"></div>
    </div>
</template>
<script>
//2.引入折线图
import { Line } from '@antv/g2plot';
export default {
    data() {
        return {
            title: '监测点信息'
        }
    },
    methods: {
        loadLineTwo() {
            const data = [
                { year: '2018', value: 3 },
                { year: '2019', value: 4 },
                { year: '2020', value: 3.5 },
                { year: '2021', value: 5 },
                { year: '2022', value: 4.9 },
                { year: '2023', value: 6 },
                { year: '2024', value: 7 },
                { year: '2024', value: 9 },
                { year: '2025', value: 13 },
            ];

            const line = new Line(this.$refs.bottom3, {
                data,
                xField: 'year',
                yField: 'value',
                 //配置x轴字段
                xAxis: {
                    label: {
                        rotate: -45,
                        style: {
                            fill: "white"
                        }
                    }
                },

                //配置Y轴字段
                yAxis: {
                    label: {

                        style: {
                            fill: "white"
                        }
                    }
                },
                point: {
                    size: 5,
                    shape: 'diamond',
                    style: {
                        fill: 'white',
                        stroke: '#5B8FF9',
                        lineWidth: 2,
                    },
                },
                tooltip: {
                    showMarkers: false,
                    domStyles: {
                        "g2-tooltip": {
                            background: "#147",
                            color: "white",
                            fontSize: "20px"
                        }
                    }
                },
                state: {
                    active: {
                        style: {
                            shadowBlur: 4,
                            stroke: '#000',
                            fill: 'red',
                        },
                    },
                },
                interactions: [{ type: 'marker-active' }],
            });

            line.render();


        },
    },
    mounted() {
        this.loadLineTwo();
    }
}
</script>
<style scoped></style>